package com.example.service.other;


import com.example.mapper.other.HelpDetailMapper;
import com.example.model.entity.other.HelpDetail;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 帮助中心详细表业务处理
 **/
@Service
public class HelpDetailService {

    @Resource
    private HelpDetailMapper helpDetailMapper;

    /**
     * 新增
     */
    public void add(HelpDetail helpDetail) {
        helpDetailMapper.insert(helpDetail);
    }

    /**
     * 删除
     */
    public void deleteById(Integer id) {
        helpDetailMapper.deleteById(id);
    }

    /**
     * 批量删除
     */
    public void deleteBatch(List<Integer> ids) {
        for (Integer id : ids) {
            helpDetailMapper.deleteById(id);
        }
    }

    /**
     * 修改
     */
    public void updateById(HelpDetail helpDetail) {
        helpDetailMapper.updateById(helpDetail);
    }

    /**
     * 根据ID查询
     */
    public HelpDetail selectById(Integer id) {
        return helpDetailMapper.selectById(id);
    }

    /**
     * 查询所有
     */
    public List<HelpDetail> selectAll(HelpDetail helpDetail) {
        return helpDetailMapper.selectAll(helpDetail);
    }

    /**
     * 分页查询
     */
    public PageInfo<HelpDetail> selectPage(HelpDetail helpDetail, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<HelpDetail> list = helpDetailMapper.selectAll(helpDetail);
        return PageInfo.of(list);
    }

    public List<HelpDetail> selectByHelpId(Integer helpId) {
        return helpDetailMapper.selectByHelpId(helpId);
    }
}
